package com.wulang.extension.listener;

import com.rabbitmq.client.Channel;
import com.wulang.extension.constants.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class DelayListener {
    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void delayListener(Message message, Channel channel) {
        System.out.printf("%tc 接收到的消息: %s, deliveryTag: %d\n", new Date(), new String(message.getBody()), "UTF-8", message.getMessageProperties().getDeliveryTag());
    }
}
